import { BadRequestException, PipeTransform } from '@nestjs/common'
import { validate } from 'uuid'


export class ParseEnumPipe implements PipeTransform<string, any> {
  constructor(private readonly enumType: any) {

  }
  transform(value: string): any {
    const enumValues = Object.values(this.enumType)
    if (!enumValues.includes(value)) {
      throw new BadRequestException('Validation failed (enum string is expected)', 'Bad Request')
    }
    return value
  }
}
